package cn.exrick.manager.controller;

import cn.exrick.common.pojo.Result;
import cn.exrick.common.utils.ResultUtil;
import cn.exrick.manager.pojo.TbSysSetting;
import cn.exrick.manager.service.SysSettingService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class SysSettingController {

    @Autowired
    private SysSettingService sysSettingService;

    @PostMapping("/sysSetting/update")
    public Result<TbSysSetting> update(TbSysSetting tbSysSetting){
        sysSettingService.updateSetting(tbSysSetting);
        return new ResultUtil<TbSysSetting>().setData(null);
    }


    @PostMapping("/sysSetting/get")
    public Result<TbSysSetting> getSysSetting(String name){
        TbSysSetting setting = sysSettingService.getSetting();
        return new ResultUtil<TbSysSetting>().setData(setting);
    }
}
